using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using IGlobalist.Cms.Model;
using IGlobalist.Cms.Bll;
using IGlobalist.Cms.Common;

namespace IGlobalist.Cms.Admin
{
    public partial class TemplateManagement : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
      
                IList<ICmsClass> classList = ClassController.GetClassListByClassTypeID((short)CmsObjectType.Template);
                ucClassList.DataSource = classList;
                ucClassList.DataBind();
                ucActionBar.ObjectTypeCurrent = CmsObjectType.Template;
                ucActionBarBottom.ObjectTypeCurrent = CmsObjectType.Template;
            }            
            ucClassList.TreeNodeClick += ucTemplateList.BindGridView;
            ucClassList.TreeNodeClick += ucTemplateAddEdit.DoHidden;
            ucClassList.TreeNodeClick += ucTemplateList.DoShow;
            ucClassList.TreeNodeClick += ucActionBar.DoViewClick;
            ucClassList.TreeNodeClick += ucActionBarBottom.DoViewClick;
            ucClassList.TreeNodeClick += HiddenInfo;

            ucTemplateList.BindUpdateTemplate += ucTemplateAddEdit.BindTemplate;
            ucTemplateList.BindUpdateTemplate += ucTemplateAddEdit.DoShow;
            ucTemplateList.BindUpdateTemplate += ucTemplateList.DoHidden;
            ucTemplateList.BindUpdateTemplate += ucActionBar.DoEditClassClick;
            ucTemplateList.BindUpdateTemplate += ucActionBarBottom.DoEditClassClick;

            ucActionBar.NewButtonClick += ucTemplateAddEdit.DoNewTemplate ;
            ucActionBar.NewButtonClick += HiddenInfo;
            ucActionBar.NewButtonClick += ucTemplateAddEdit.DoShow;
            ucActionBar.NewButtonClick += ucTemplateList.DoHidden;
            ucActionBarBottom.NewButtonClick += ucTemplateAddEdit.DoNewTemplate;
            ucActionBarBottom.NewButtonClick += ucTemplateAddEdit.DoShow;
            ucActionBarBottom.NewButtonClick += ucTemplateList.DoHidden;
            ucActionBarBottom.NewButtonClick += HiddenInfo;
            ucActionBarBottom.NewButtonClick += ucActionBar.DoEditClassClick;
            ucActionBar.NewButtonClick += ucActionBarBottom.DoEditClassClick;
            ucActionBarBottom.NewButtonClick += ucActionBarBottom.DoEditClassClick;
            ucActionBar.NewButtonClick += ucActionBar.DoEditClassClick;

            ucActionBar.SaveButtonClick += ucTemplateAddEdit.DoSaveTemplate;
            ucActionBarBottom.SaveButtonClick += ucTemplateAddEdit.DoSaveTemplate;
            //ucActionBar.SaveButtonClick += ucTemplateAddEdit.DoHidden;
            //ucActionBar.SaveButtonClick += ucTemplateList.DoShow;

            

            ucActionBar.CopyButtonClick += ucTemplateAddEdit.DoCopyTemplate;
            ucActionBar.CopyButtonClick += ucTemplateAddEdit.DoShow;
            ucActionBar.CopyButtonClick += ucTemplateList.DoHidden;
            ucActionBarBottom.CopyButtonClick += ucTemplateAddEdit.DoCopyTemplate;
            ucActionBarBottom.CopyButtonClick += ucTemplateAddEdit.DoShow;
            ucActionBarBottom.CopyButtonClick += ucTemplateList.DoHidden;      

            ucActionBar.DeleteButtonClick += ucTemplateAddEdit.DoDeleteTemplate;
            ucActionBar.DeleteButtonClick += ucTemplateAddEdit.DoHidden;
            ucActionBar.DeleteButtonClick += ucTemplateList.DoShow;
            ucActionBarBottom.DeleteButtonClick += ucTemplateAddEdit.DoDeleteTemplate;
            ucActionBarBottom.DeleteButtonClick += ucTemplateAddEdit.DoHidden;
            ucActionBarBottom.DeleteButtonClick += ucTemplateList.DoShow;

            


        }
        public void HiddenInfo(object sender, EventArgs e)
        {
            pnlInfo.Visible = false;
        }
    }
}
